package com.tjmntv.tj.myapplication.demo1

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

/**
 * @author wzw
 * @date 2021/8/16 14:16
 */
class MyViewModel : ViewModel() {

    private val _number: MutableLiveData<Int> by lazy {
        MutableLiveData<Int>().also {
            it.value = 0
        }
    }
    val number: LiveData<Int>
        get() = _number
//    val numer:MutableLiveData<Int>
//    init {
//        numer = MutableLiveData()
//        numer.value = 0
//    }

    fun modifyMuner(aNumber: Int) {
        _number.value = _number.value?.plus(aNumber)
    }
}